package com.study.agp.room;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import java.util.List;

@Dao
public interface UserDao {

    @Insert
    public long insert(UserEntity user);

    @Delete
    public int delete(UserEntity user);

    @Query("select * from UserEntity where lastName = :lastName")
    public List<UserEntity> findUsers(String lastName);

    @Query("select * from UserEntity")
    public List<UserEntity> findAllUsers();

    @Query("delete from UserEntity where age > :age")
    public int deleteByAge(int age);

    @Query("delete from UserEntity")
    public void clearUserTable();
}
